﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="分页.aspx.cs" Inherits="分页" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
   <form id="form1" runat="server">
   
    <div>
        DataGrid自定义分页<br />
        <br />
    
    <asp:DataGrid runat="server" ID="MyDataGrid"  AutoGenerateColumns="False" ShowHeader="False" PageSize="4" AllowPaging="True" Width="566px">
        <PagerStyle Visible=False HorizontalAlign=Right Mode=NumericPages ForeColor="#404040" /><AlternatingItemStyle BackColor="Gainsboro" />
        <Columns>
            <asp:BoundColumn DataField="newsid" HeaderText="ID"></asp:BoundColumn>
            <asp:BoundColumn DataField="title" HeaderText="Title"></asp:BoundColumn>
            <asp:BoundColumn DataField="Content" HeaderText="Content"></asp:BoundColumn>
        </Columns>
    </asp:DataGrid><br />
        <!--定义 上一页 下一页  --></div>
    					<asp:label id="lblPageCount" runat="server"></asp:label><asp:label id="lblCurrentIndex" runat="server"></asp:label>
						<asp:linkbutton id="btnFirst" onclick="PageButtonClick" runat="server" CommandArgument="0" >最首頁</asp:linkbutton>
						<asp:linkbutton id="btnPrev" onclick="PageButtonClick" runat="server" CommandArgument="prev">前一頁</asp:linkbutton>
						<asp:linkbutton id="btnNext" onclick="PageButtonClick" runat="server" CommandArgument="next">下一頁</asp:linkbutton>
						<asp:linkbutton id="btnLast" onclick="PageButtonClick" runat="server" CommandArgument="last">最後頁</asp:linkbutton>
    
    </form>
</body>
</html>
